<?php
/**
 *
 * @author yupoxiong<i@yupoxiong.com>
 */

declare (strict_types = 1);

namespace app\school\controller;
use app\common\model\Brand;
use app\common\model\Spec;
use app\common\model\Type;
use hg\apidoc\annotation as Apidoc;
use think\response\Json;

/**
 * @Apidoc\Title("首页")
 * @Apidoc\Group("index")
 */
class IndexController extends ApiBaseController {
	protected array $loginExcept = [
		'school/index/index',
	];
	/**
	 * @Apidoc\Title("商品type/规格spec/单位brand")
	 * @Apidoc\Desc("首页")
	 * @Apidoc\Method("GET")
	 * @Apidoc\Url("/school/index/index")
	 * @Apidoc\Returned("data",        type="int",                 desc="desc")
	 */
	public function index(): Json {
		$type = Type::select();
		$data = [
			'type' => Type::with(['spec', 'brand'])->where('tag', 1)->select(),
			'spec' => Spec::select(),
			'brand' => Brand::select(),
		];
		return api_success($data);
	}

}
